<template>
	<div id="visit_record" class="dialog animated" :class="open? 'fadeIn':'fadeOut'" v-show="show">
		<div class="panel animated" :class="open? 'zoomIn':''">
			<div class="title">
				{{clue.realName}}
				<div class="close" @click="cancel()"></div>
			</div>
			<div class="form">
				<div class="intention_div">
					<div class="intention" v-for="item in clue.courseData">
						<label>意向课程：{{item.courseName}}</label>
						<label>意向度：{{item.intentionModeName}}</label>
					</div>
				</div>
				<table class="table" cellspacing="0">
					<thead class="thead">
						<tr>
							<td style="width: 3rem;">回访日期</td>
							<td style="width: 4rem;">沟通内容</td>
							<td style="width: 1.5rem;">跟进人</td>
							<td style="width: 1.5rem;">操作人</td>
							<td style="width: 1.5rem;">线索状态</td>
							<td style="width: 3rem;">下次沟通时间</td>
						</tr>
					</thead>
					<tbody class="tbody">
						<tr v-for="item in visitList">
		  					<td>{{item.visitTime}}</td>
		  					<td>{{item.visitContent}}</td>
		  					<td>{{item.executeUserName}}</td>
		  					<td>{{item.createUserName}}</td>
		  					<td>{{clueStatusMap[item.clueStatus]}}</td>
		  					<td>{{item.nextVisitTime}}</td>
		  				</tr>
					</tbody>
				</table>
			</div>
		</div>
	</div>
</template>

<script>
var vm,dict;
export default {
	data : function() {
		return {
			show : false,
			open : false,
			clue : {},
			visitList : null,
			
			clueStatusMap : null,
		}
	},
	methods : {
		init : function(clue) {
			vm.show = true;
			vm.open = true;
			
			vm.clue = clue;
			api.visitByClue({clueId : clue.clueId}).then(function(data) {
				vm.visitList = data.data.visitList;
			})
		},
		cancel : function() {
			vm.open = false;
			setTimeout(function() {
				vm.show = false;
			},500);
		},
	},
	created : function() {
		vm = this;
		dict = tool.getItem(lsKey.dict,true);
		
		vm.clueStatusMap = tool.parseDict(dict["clue_status"]);
	}
}

</script>

<style scoped src="@/style/module/dialog.css"></style>
<style scoped src="@/style/module/table.css"></style>
<style scoped>

	.panel {
		width: 12rem;
		margin: 0.5rem auto;
	}
	.form {
		padding: 0 0.3rem 0.5rem 0.3rem;
		color: #666666;
	}
	.intention_div {
		padding-bottom: 0.2rem;
	}
	.intention {
		line-height: 0.3rem;
		font-size: 0.16rem;	
	}
	.intention>label:first-child {
		display: inline-block;
		min-width: 2.5rem;
	}
</style>